package com.frank.practice.enums;

import lombok.Getter;

/**
 * @author Frank Zou
 * @version v0.0.1
 * @date 2024/1/25 2:04 PM
 * @description 题目类型枚举
 * 1单选 2多选 3判断 4简答
 */
@Getter
public enum SubjectInfoTypeEnum {

    /**
     * 单选题
     */
    RADIO(1, "单选题"),
    /**
     * 多选题
     */
    MULTIPLE(2, "多选题"),
    /**
     * 判断题
     */
    JUDGE(3, "判断题"),
    /**
     * 简答题
     */
    BRIEF(4, "简答题");

    private final Integer code;

    private final String description;

    SubjectInfoTypeEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static  SubjectInfoTypeEnum getByCode(Integer code) {
        for (SubjectInfoTypeEnum subjectInfoTypeEnum : SubjectInfoTypeEnum.values()) {
            if (subjectInfoTypeEnum.getCode().equals(code)) {
                return subjectInfoTypeEnum;
            }
        }
        return null;
    }
}
